const Clutter = imports.gi.Clutter;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
-const Gtk = imports.gi.Gtk;
const Mainloop = imports.mainloop;
const Meta = imports.gi.Meta;
const Shell = imports.gi.Shell;
sessionMode.connect('updated', _sessionUpdated);
St.Settings.get().connect('notify::gtk-theme', _loadDefaultStylesheet);
- Gtk.IconTheme.get_default().add_resource_path('/org/gnome/shell/theme/icons');
_initializeUI();
shellAccessDialogDBusService = new AccessDialog.AccessDialogDBus();
#include "st-texture-cache.h"
#include "st-private.h"
+#include "st-settings.h"
#include <gtk/gtk.h>
#include <string.h>
#include <glib.h>
struct _StTextureCachePrivate
{
GtkIconTheme *icon_theme;
+ GSettings *settings;
/* Things that were loaded with a cache policy != NONE */
GHashTable *keyed_cache; /* char * -> ClutterImage* */
}
static void
-on_icon_theme_changed (GtkIconTheme *icon_theme,
+on_icon_theme_changed (StSettings *settings,
+ GParamSpec *pspec,
StTextureCache *cache)
{
+ g_autofree gchar *theme;
+
st_texture_cache_evict_icons (cache);
+
+ g_object_get (settings, "gtk-icon-theme", &theme, NULL);
+ gtk_icon_theme_set_custom_theme (cache->priv->icon_theme, theme);
+
g_signal_emit (cache, signals[ICON_THEME_CHANGED], 0);
}
static void
st_texture_cache_init (StTextureCache *self)
{
+ StSettings *settings;
+
self->priv = g_new0 (StTextureCachePrivate, 1);
- self->priv->icon_theme = gtk_icon_theme_get_default ();
- g_signal_connect (self->priv->icon_theme, "changed",
+ self->priv->icon_theme = gtk_icon_theme_new ();
+ gtk_icon_theme_add_resource_path (self->priv->icon_theme,
+ "/org/gnome/shell/theme/icons");
+
+ settings = st_settings_get ();
+ g_signal_connect (settings, "notify::gtk-icon-theme",
G_CALLBACK (on_icon_theme_changed), self);
self->priv->keyed_cache = g_hash_table_new_full (g_str_hash, g_str_equal,
self->priv->file_monitors = g_hash_table_new_full (g_file_hash, (GEqualFunc) g_file_equal,
g_object_unref, g_object_unref);
+ on_icon_theme_changed (settings, NULL, self);
}
static void
{
StTextureCache *self = (StTextureCache*)object;
- if (self->priv->icon_theme)
- {
- g_signal_handlers_disconnect_by_func (self->priv->icon_theme,
- (gpointer) on_icon_theme_changed,
- self);
- self->priv->icon_theme = NULL;
- }
+ g_clear_object (&self->priv->settings);
+ g_clear_object (&self->priv->icon_theme);
g_clear_pointer (&self->priv->keyed_cache, g_hash_table_destroy);
g_clear_pointer (&self->priv->keyed_surface_cache, g_hash_table_destroy);